package com.weberror.frontendmonitoring.userbehaviordata.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.extension.activerecord.Model;

import java.io.Serializable;
import java.text.SimpleDateFormat;
import java.util.Date;

/**
 * 用户行为数据(Userbehaviordata)表实体类
 *
 * @author cnxym
 * @since 2022-08-17 20:00:55
 */
@TableName(value = "userbehaviordata")
public class Userbehaviordata {
    //行为id
    @TableId(value = "userbehavior_id", type= IdType.AUTO)
    private Integer userbehaviorId;
    //页面url
    @TableField(value = "userbehavior_page")
    private String userbehaviorPage;
    //用户行为上报/获取
    @TableField(value = "userbehavior_type")
    private String userbehaviorType;
    //访问量
    @TableField(value = "userbehavior_pv")
    private Long userbehaviorPv;
    //用户量
    @TableField(value = "userbehavior_uv")
    private Long userbehaviorUv;
    //凌晨时间数据
    @TableField(value = "userbehavior_time")
    private String userbehaviorTime;


    public Integer getUserbehaviorId() {
        return userbehaviorId;
    }

    public void setUserbehaviorId(Integer userbehaviorId) {
        this.userbehaviorId = userbehaviorId;
    }

    public String getUserbehaviorPage() {
        return userbehaviorPage;
    }

    public void setUserbehaviorPage(String userbehaviorPage) {
        this.userbehaviorPage = userbehaviorPage;
    }

    public String getUserbehaviorType() {
        return userbehaviorType;
    }

    public void setUserbehaviorType(String userbehaviorType) {
        this.userbehaviorType = userbehaviorType;
    }

    public Long getUserbehaviorPv() {
        return userbehaviorPv;
    }

    public void setUserbehaviorPv(Long userbehaviorPv) {
        this.userbehaviorPv = userbehaviorPv;
    }

    public Long getUserbehaviorUv() {
        return userbehaviorUv;
    }

    public void setUserbehaviorUv(Long userbehaviorUv) {
        this.userbehaviorUv = userbehaviorUv;
    }

    public String getUserbehaviorTime() {
        return userbehaviorTime;
    }

    public void setUserbehaviorTime(Object userbehaviorTime) {
        if (userbehaviorTime instanceof Date) {
            SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
            Date date = (Date) userbehaviorTime;
            this.userbehaviorTime = dateFormat.format(date);
        } else if (userbehaviorTime instanceof Long) {
            SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
            Date date = new Date((Long) userbehaviorTime);
            this.userbehaviorTime = dateFormat.format(date);
        }
    }

}

